SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwrDocumentacionMovimientosPendientes
AS
SELECT     IdDocumentacion AS ID, COUNT(IdDocumentacionMovimientos) AS Pendientes, FechaSalida
FROM         dbo.tb_DocumentacionMovimientos
GROUP BY IdDocumentacion, FechaSalida
HAVING      (FechaSalida IS NULL)

GO
GRANT SELECT ON  [dbo].[vwrDocumentacionMovimientosPendientes] TO [GestionDespacho]
GRANT SELECT ON  [dbo].[vwrDocumentacionMovimientosPendientes] TO [Informatica]
GRANT SELECT ON  [dbo].[vwrDocumentacionMovimientosPendientes] TO [SoloVer]
GO
